<html>
<body>


<iframe id="abcads" src="" window=500 height=500 ></iframe>
<div id="ob2"></div>
<script>

$_ad="12341234123412341234123412341234"
gyrox=0
dmid="ob2"
setTimeout(logic,5000)
function logic(){
	console.log(isresolu() +" "+ isgyro())
	if (isresolu() && isgyro()){
		console.log("手机")
		document.getElementById(dmid).innerHTML=$_ad
	}
}

function isresolu(){
	if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){ 
    if(window.location.href.indexOf("?mobile")<0){ 
        try{ 
            if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){ 
                console.log("mresole")
                mobiles=[
                	[640,360],
                	[667,375],
                	[732,412],
                	[736,414],
                ]
                for (i in mobiles){
	                	if(mobiles[i][0]==window.screen.height && mobiles[i][1]==window.screen.width){
	                        return true
	                	}
                }  
            }
        }catch(e){} 
    } 
}
return false
}

function isgyro(){
	return gyrox
}

function in_array(search,array){
    for(var i in array){
        if(array[i]==search){
            return true;
        }
    }
    return false;
}

if(window.DeviceOrientationEvent) {
	gav = new Array()
	gbv = new Array()
	ggv = new Array()
    window.addEventListener('deviceorientation', function(event) {

window.ga = Math.round(event.alpha*100);
window.gb = Math.round(event.beta*100);
window.gg = Math.round(event.gamma*100);

if(!in_array(window.ga,gav)){
	gav.push(window.ga)
}
if(!in_array(window.gb,gbv)){
	gbv.push(window.gb)
}
if(gav.length >3 && gbv.length>3){
	gyrox=1
}
    }, false);
}


</script>
</body>
</html>